import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:industry_net/base/common/util.dart';
import 'package:industry_net/pages/news/main/models/news.dart';

import '../controller.dart';

class NewsImagesCell extends StatelessWidget {
  NewsImagesCell({Key? key, required this.md}) : super(key: key);
  final NewsModel md;
  final controller = Get.find<ContentController>();
  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () => controller.actionCellClick(md),
      child: Padding(
        padding: EdgeInsets.symmetric(horizontal: gap12, vertical: gap10),
        child: Column(
          children: [
            Text(
              '通风降温这样简单的操作,会导致大棚蔬菜的产量与品质不同吗？',
              style: pfSCStyle(color: ColorsUtil.title, fontSize: font15),
            ),
            SizedBox(
              height: gap10,
            ),
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [1, 2, 3]
                  .asMap()
                  .map(
                    (key, value) => MapEntry(
                      key,
                      ClipRRect(
                        borderRadius: BorderRadius.circular(circle4),
                        child: Container(
                          width: 110.r,
                          height: 70.r,
                          decoration: BoxDecoration(
                            image: DecorationImage(
                              image: loadImageProvider(
                                  url:
                                      'http://www.news.cn/photo/2021-12/29/1128213366_16407641188621n.jpg'),
                              fit: BoxFit.cover,
                            ),
                          ),
                          child: key == 2
                              ? Container(
                                  decoration: const BoxDecoration(
                                      color: Colors.black45),
                                  child: Center(
                                    child: Text(
                                      '+3',
                                      style: pfMediumStyle(
                                          color: Colors.white,
                                          fontSize: font14),
                                    ),
                                  ),
                                )
                              : null,
                        ),
                      ),
                    ),
                  )
                  .values
                  .toList(),
            ),
            SizedBox(
              height: 5.r,
            ),
            Row(
              children: [
                Text(
                  '央广网',
                  style: pfMediumStyle(
                      color: ColorsUtil.content, fontSize: font12),
                ),
                SizedBox(
                  width: gap10,
                ),
                Text(
                  md.createTimeStr,
                  style: pfMediumStyle(
                      color: ColorsUtil.content, fontSize: font12),
                ),
                SizedBox(
                  width: gap10,
                ),
                Text(
                  '9999次浏览',
                  style: pfMediumStyle(
                      color: ColorsUtil.content, fontSize: font12),
                ),
              ],
            )
          ],
        ),
      ),
    );
  }
}
